home *** CD-ROM | disk | FTP | other *** search
- /*
- one rectangle.c
-
- This file contains the calls that an application needs to make for the "graphics shell" to work correctly.
- This "one rectangle" will draw 1 black rectangle ( {0, 0, ff(100), ff(100)} ) in the upper left corner of the window.
-
- NOTES:
- • This file requires the new "GX"-ified interface files and libraries. With the interface files, all types and function
- names are proceeded by a "gx" for types or "GX" for function names.
-
- • This file requires the following files to run correctly:
- "graphics shell .c", "ColorLibrary.c", "GraphicsDebugLibrary.c", "TransformLibrary.c".
-
- • This file prints the "best" in landscape mode.
-
- Change History:
-
- 4/96 bob Updated #includes to support changed GX Library names.
- Updated the note regarding the files needed to run.
- Updated the copyright date.
-
- ©1992 - 1996 Apple Computer, Inc. All rights reserved.
- */
-
- #include <events.h>
- #include <windows.h>
-
- #include "GraphicsLibraries.h"
- #include <GXEnvironment.h>
- #include "graphics shell.h"
-
- //
- // Set up the title and size of the window
- //
- Str255 gWindowTitle = "\p one rectangle ";
- Rect gWindowQDRect = {50, 50, 275, 275};
-
- //
- // gGraphicsHeapSize sets the size of the graphics heap created by calling the NewGraphicsClient routine
- // in main () within graphics shell.c. You can determine the amount of graphics heap required by using GraphicsBug.
- // With gGraphicsHeapSize set to 25k, I had 2 free blocks left in the graphics heap. Sounds good to me.
- //
- long gGraphicsHeapSize = 25;
-
- gxShape gShape;
-
-
- /*------ DoInitialization ---------------------------------------------------------------------------------*/
- //
- // This function is creates the shape we want to draw on DoDraw
- //
-
- void DoInitialization(gWindow)
- WindowPtr gWindow;
- {
- gxRectangle rectData = {0, 0, ff(100), ff(100)};
-
- gShape = GXNewRectangle(&rectData);
- }
-
-
- /*------ DoDraw ---------------------------------------------------------------------------------------*/
- //
- // This function performs all of the drawing by calling GXDrawShape on our global shape - gShape.
- //
- void DoDraw( gWindow )
- WindowPtr gWindow;
- {
- GXDrawShape ( gShape );
- }
-
-
- /*------ DoDispose -------------------------------------------------------------------------------------*/
- //
- // This function tosses all of the shapes and the window we have created.
- //
- void DoDispose( gWindow )
- WindowPtr gWindow;
- {
- //
- // You should always dispose of your QuickDraw GX objects before tossing your window. Why? It's generally good
- // form and this approach guarantees that everything is disposed. If you had not disposed of everything, the
- // call to DisposeWindow should dispose of the objects. If you are running the debugging version of the
- // "GXGraphics(debug)" extension with notices enabled, you will receive a notice that you had not disposed of
- // everything when you app quits.
- //
- // Notices are enabled within the "grahics shell.c" automatically, if you have installed the debug
- // extension. We determine if the debug init is installed by making the appropriate Gestalt call while the
- // graphics shell is starting up; see the "graphics shell.c" file for details.
- //
- GXDisposeShape( gShape );
- GXDisposeShape( gWindowBoundsShape );
- DisposeWindow( gWindow );
- }
-
-
-
- /*------ DoClick ---------------------------------------------------------------------------------------*/
- //
- // This function handles click by the user...
- //
- void DoClick( orgMouseLoc, theWindow )
- gxPoint orgMouseLoc;
- WindowPtr theWindow;
- {
- }
-
-
- /*------ DoIdle ----------------------------------------------------------------------------------------*/
- //
- // This function is called within the event loop when the "graphics shell" receives a null event...
- //
- void DoIdle(gWindow)
- WindowPtr gWindow;
- {
- }
-